import * as React from 'react';
import './footer.less';

interface FooterProps {
  links?: Array<{
    key: string;
    title: React.ReactNode;
    href: string;
    blankTarget?: boolean;
  }>;
  copyright?: React.ReactNode;
}

export default ({ links, copyright }: FooterProps) => {
  return (
    <div className="footer">
      {links && (
        <div className="links">
          {links.map(link => (
            <a key={link.key} target={link.blankTarget ? '_blank' : '_self'} href={link.href}>
              {link.title}
            </a>
          ))}
        </div>
      )}
      {copyright && <div className="copyright">{copyright}</div>}
    </div>
  );
};
